<?php if (!defined('THINK_PATH')) exit(); /*a:2:{s:67:"F:\liudian\fly_forum\public/../application/index\view\User\reg.html";i:1520384633;s:53:"F:\liudian\fly_forum\application\index\view\base.html";i:1520385158;}*/ ?>


<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title><?php echo $title; ?></title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="keywords" content="fly,layui,前端社区">
    <meta name="description" content="Fly社区是模块化前端UI框架Layui的官网社区，致力于为web开发提供强劲动力">
    <link rel="stylesheet" href="/fly_forum/public/static/layui/css/layui.css">
    <link rel="stylesheet" href="/fly_forum/public/static/home/css/global.css">
</head>
<body>

<div class="fly-header layui-bg-black">
    <div class="layui-container">
        <a class="fly-logo" href="<?php echo url('Index/index'); ?>">
            <img src="/fly_forum/public/static/home/images/logo.png" alt="layui">
        </a>
        <ul class="layui-nav fly-nav layui-hide-xs">
            <li class="layui-nav-item layui-this">
                <a href="/"><i class="iconfont icon-jiaoliu"></i>交流</a>
            </li>
            <li class="layui-nav-item">
                <a href="case/case.html"><i class="iconfont icon-iconmingxinganli"></i>案例</a>
            </li>
            <li class="layui-nav-item">
                <a href="http://www.layui.com/" target="_blank"><i class="iconfont icon-ui"></i>框架</a>
            </li>
        </ul>

        <ul class="layui-nav fly-nav-user">

            
            <?php if(empty(\think\Session::get('home'))): ?>
                <!-- 未登入的状态 -->
                <li class="layui-nav-item">
                    <a class="iconfont icon-touxiang layui-hide-xs" href="<?php echo url('User/login'); ?>"></a>
                </li>
                <li class="layui-nav-item">
                    <a href="<?php echo url('User/login'); ?>">登入</a>
                </li>
                <li class="layui-nav-item">
                    <a href="<?php echo url('User/reg'); ?>">注册</a>
                </li>
            <?php else: ?>
                <!-- 登入后的状态 -->
                <li class="layui-nav-item">
                    <?php if(empty(\think\Session::get('home.image'))): ?>
                        <a class="iconfont icon-touxiang layui-hide-xs" href="<?php echo url('User/set'); ?>"></a>
                    <?php else: ?>
                        <a  href="<?php echo url('User/set'); ?>"><img style="height: 40px;width: 40px;border-radius: 20px" src="<?php echo get_img_url('/fly_forum/public/static/../upload/headImg/',session('home.image'),0); ?>"></a>
                    <?php endif; ?>

                </li>
                <li class="layui-nav-item">
                    <a href="<?php echo url('User/set'); ?>"><?php echo \think\Session::get('home.name'); ?></a>
                </li>
                <li class="layui-nav-item">
                    <a href="<?php echo url('User/loginOut'); ?>">退出</a>
                </li>
            <?php endif; if(empty(\think\Session::get('home'))): ?>
            <li class="layui-nav-item layui-hide-xs">
                <a href="<?php echo url('User/qqlogin'); ?>" onclick="layer.msg('正在通过QQ登入', {icon:16, shade: 0.1, time:0})" title="QQ登入" class="iconfont icon-qq"></a>
            </li>
            <!-- <li class="layui-nav-item layui-hide-xs">
                <a href="/app/weibo/" onclick="layer.msg('正在通过微博登入', {icon:16, shade: 0.1, time:0})" title="微博登入" class="iconfont icon-weibo"></a> -->
            </li>
            <?php else: endif; ?>

            
        </ul>
    </div>
</div>



<script src="/fly_forum/public/static/home/js/jquery-1.7.2.js"></script>
<script src="/fly_forum/public/static/layui/layui.js"></script>

<div class="layui-container fly-marginTop">
    <div class="fly-panel fly-panel-user" pad20>
        <div class="layui-tab layui-tab-brief" lay-filter="user">
            <ul class="layui-tab-title">
                <li><a href="<?php echo url('User/login'); ?>">登入</a></li>
                <li class="layui-this">注册</li>
            </ul>
            <div class="layui-form layui-tab-content" id="LAY_ucm" style="padding: 20px 0;">
                <div class="layui-tab-item layui-show">
                    <div class="layui-form layui-form-pane">
                        <form method="post" id="register" action="<?php echo url('User/regDo'); ?>">
                            <div class="layui-form-item">
                                <label for="L_email" class="layui-form-label">邮箱</label>
                                <div class="layui-input-inline">
                                    <input type="text" id="L_email" name="email" required lay-verify="email" autocomplete="off" class="layui-input">
                                </div>
                                <div class="layui-form-mid layui-word-aux" >将会成为您唯一的登入名</div>
                            </div>
                            <div class="layui-form-item">
                                <label for="L_username" class="layui-form-label">昵称</label>
                                <div class="layui-input-inline">
                                    <input type="text" id="L_username" name="username" required lay-verify="required" autocomplete="off" class="layui-input">
                                </div>
                                <div class="layui-form-mid layui-word-aux">2-8个汉字或字母</div>
                            </div>
                            <div class="layui-form-item">
                                <label for="L_sex" class="layui-form-label">性别</label>
                                <div class="layui-input-inline">
                                    <input type="radio" name="sex" value="0" title="男" checked>
                                    <input type="radio" name="sex" value="1" title="女">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label for="L_pass" class="layui-form-label">密码</label>
                                <div class="layui-input-inline">
                                    <input type="password" id="L_pass" name="pass" required lay-verify="required" autocomplete="off" class="layui-input">
                                </div>
                                <div class="layui-form-mid layui-word-aux">6到16个字符</div>
                            </div>
                            <div class="layui-form-item">
                                <label for="L_repass" class="layui-form-label">确认密码</label>
                                <div class="layui-input-inline">
                                    <input type="password" id="L_repass" name="repass" required lay-verify="required" autocomplete="off" class="layui-input">
                                </div>
                                <div class="layui-form-mid layui-word-aux"></div>
                            </div>
                            <!--<div class="layui-form-item">-->
                                <!--<label for="L_vercode" class="layui-form-label">人类验证</label>-->
                                <!--<div class="layui-input-inline">-->
                                    <!--<input type="text" id="L_vercode" name="vercode" required lay-verify="required" placeholder="请输入后面的验证码" autocomplete="off" class="layui-input">-->
                                <!--</div>-->
                                <!--<div class="layui-form-mid">-->
                                    <!--&lt;!&ndash; <span style="color: #c00;">{{d.vercode}}</span> &ndash;&gt;-->
                                    <!--<img src="<?php echo captcha_src(); ?>" alt="captcha" style="height: 38px;margin-top: -8px" onclick="this.src=this.src+'?i='+Math.random()"/>-->
                                <!--</div>-->
                            <!--</div>-->
                            <div class="layui-form-item">
                                <label for="L_vercode" class="layui-form-label">邮箱验证</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="ecode" id="ecode" required  lay-verify="required"  autocomplete="off" class="layui-input"   >
                                    <div class="layui-form-mid">
                                        <input type="button" onClick="javascript:send_mail();" value="发送验证码" name="send_test_email" class="input-btn" id="send_test_email">
                                    </div>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <button class="layui-btn"  lay-submit>立即注册</button>
                            </div>
                            <div class="layui-form-item fly-form-app">
                                <span>或者直接使用社交账号快捷登录</span>
                                <a href="<?php echo url('user/qqlogin'); ?>"  class="iconfont icon-qq" title="QQ登入"></a>
                                <!-- <a href="" onclick="layer.msg('正在通过微博登入', {icon:16, shade: 0.1, time:0})" class="iconfont icon-weibo" title="微博登入"></a> -->
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>

</div>

<div class="fly-footer">
    <p><a href="http://fly.layui.com/" target="_blank">Fly社区</a> 2017 &copy; <a href="http://www.layui.com/" target="_blank">layui.com 出品</a></p>
    <p>
        <a href="http://fly.layui.com/jie/3147/" target="_blank">付费计划</a>
        <a href="http://www.layui.com/template/fly/" target="_blank">获取Fly社区模版</a>
        <a href="http://fly.layui.com/jie/2461/" target="_blank">微信公众号</a>
    </p>
</div>
<script>
    var check_email = false;
    $("#L_email").blur(function(){
        
        var email = $("#L_email").val();
        var emailRegx = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+$/;
        if(!emailRegx.test(email)){
            $("#L_email").parent().next().removeClass("layui-word-aux").css("color","red");
            check_email = false;
        }else{
            $("#L_email").parent().next().addClass("layui-word-aux");
            check_email = true;
        }
    })

    var check_username = false;
    $("#L_username").blur(function(){
        
        var username = $("#L_username").val();
        if(username.length > 8 || username.length < 2){
            $("#L_username").parent().next().removeClass("layui-word-aux").css("color","red");
            check_username = false;
        }else{
            $("#L_username").parent().next().addClass("layui-word-aux");
            check_username = true;
        }
    })

    var check_pass = false;
    $("#L_pass").blur(function(){
        
        var pass = $("#L_pass").val();
        if(pass.length > 16 || pass.length < 6){
           $("#L_pass").parent().next().removeClass("layui-word-aux").css("color","red");
           check_pass = false;
        }else{
            $("#L_pass").parent().next().addClass("layui-word-aux");
            check_pass = true;
        }
    })

    var check_repass = false;
    $("#L_repass").blur(function(){
        
        var repass = $("#L_repass").val();
        var pass = $("#L_pass").val();

        if(repass != pass){
           $("#L_repass").parent().next().removeClass("layui-word-aux").css("color","red");
           $("#L_repass").parent().next().html("两次输入密码不一致");
           check_repass = false;
        }else{
            $("#L_repass").parent().next().html("");
            check_repass = true;
            if(repass.length > 16 || repass.length < 6){
            $("#L_repass").parent().next().removeClass("layui-word-aux").css("color","red");
            $("#L_repass").parent().next().html("6到16个字符");
            check_repass = false;
            }else{
                $("#L_repass").parent().next().addClass("layui-word-aux");
                check_repass = true;
            }
        }
        
    })


    //如果上面有一个验证不通过,就不提交表单
    $("#register").submit(function(){
        //如果输入框有空值的,不提交表单

        if((check_email === true) && (check_username === true) && (check_pass === true) && (check_repass === true)){
            return true;
        }else{
            return false;
        }           
    })        

    function send_mail() {
        var email = $('#L_email').val();

        $.ajax({
            type: "post",
            data: $('#register').serialize(),
            dataType: 'json',
            url: "<?php echo url('User/send_mail','',''); ?>",
            success: function (res) {
                if (res.status == 1) {
                    alert('发送成功');
                } else {
                    alert('发送失败');

                }
            }
        })
    }
</script>

<script>
    layui.cache.page = '';
    layui.cache.user = {
        username: '游客'
        ,uid: -1
        ,avatar: '/fly_forum/public/static/home/images/avatar/00.jpg'
        ,experience: 83
        ,sex: '男'
    };
    layui.config({
        version: "3.0.0"
        ,base: '/fly_forum/public/static/home/mods/' //这里实际使用时，建议改成绝对路径
    }).extend({
        fly: 'index'
    }).use('fly');
</script>

<script type="text/javascript">var cnzz_protocol = (("https:" == document.location.protocol) ? " https://" : " http://");document.write(unescape("%3Cspan id='cnzz_stat_icon_30088308'%3E%3C/span%3E%3Cscript src='" + cnzz_protocol + "w.cnzz.com/c.php%3Fid%3D30088308' type='text/javascript'%3E%3C/script%3E"));</script>

</body>
</html>